import axios from 'axios';
export const uploadToGithub = (filename,base64Img) => {
    // console.log(base64Img)
 const URL = `https://api.github.com/repos/hanjinqi/han/contents/img/${filename}`;
//  console.log(filename);
 // request 请求实例
 return axios({
 url: URL,
 method: 'put',
 headers: {
 Accept: "application/vnd.github.v3+json",
 Authorization: 'token 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'
 },
 data:{
 "message":"test1",
 "committer": {
 "name": "hanjinqi",
 "email": "864687095@qq.com"
 },
 "content":base64Img
 }
 });
};


// import axios from "axios";
// export const uploadToGithub = (filename, base64Img) => {
//   console.log(filename);
//   const URL = `https://api.github.com/repos/zmf-6/cdn/contents/img/${filename}`;
//   // request 请求实例
//   return axios({
//     url: URL,
//     method: "put",
//     headers: {
//       Accept: "application/vnd.github.v3+json",
//       Authorization: 'token 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'
//     },
//     data: {
//       message: "test1",
//       committer: {
//         name: "zmf-6",
//         email: "3073799663@qq.com"
//       },
//       content: base64Img
//     }
//   });
// };